package mya_dc.shared_classes.gui;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;

import com.swtdesigner.SwingResourceManager;

/**
 * a Dialog that shows MYA's About window
 * 
 * @author      Adam Levi
 * <br>			MYA
 */
public class AboutWindow extends JDialog
{

	private static final long serialVersionUID = 6146609741984501816L;
	final static String aboutString = "" +
	"Distributed Compiler\n " +
	"Version 1.00\n" +
	"Copyright(c) 2008\n";
	
	/**
	 * Create the dialog
	 */
	private AboutWindow(JFrame owner)
	{
		super(owner);
		getContentPane().setBackground(new Color(230, 230, 250));
		getContentPane().setLayout(null);
		setTitle("About MYA DC");
		setBounds(100, 100, 372, 274);

		final JLabel label = new JLabel();
		label.setBounds(0, 0, 210, 197);
		getContentPane().add(label);
		label.setText("New JLabel");
		label.setIcon(SwingResourceManager.getIcon("images/logo_about.jpg"));
		

		final JButton okButton = new JButton();
		okButton.addActionListener(new ActionListener() {
			public void actionPerformed(final ActionEvent e) {
				doClose();
			}
		});
		okButton.setText("OK");
		okButton.setBounds(248, 206, 106, 27);
		getContentPane().add(okButton);

		final JLabel myaDcLabel = new JLabel();
		myaDcLabel.setHorizontalAlignment(SwingConstants.CENTER);
		myaDcLabel.setForeground(new Color(0, 0, 255));
		myaDcLabel.setFont(new Font("Bauhaus 93", Font.BOLD, 20));
		myaDcLabel.setText("MYA DC");
		myaDcLabel.setBounds(216, 10, 138, 27);
		getContentPane().add(myaDcLabel);

		final JLabel myaDcLabel_1 = new JLabel();
		myaDcLabel_1.setHorizontalAlignment(SwingConstants.CENTER);
		myaDcLabel_1.setFont(new Font("Bodoni MT", Font.PLAIN, 14));
		myaDcLabel_1.setText("Version 1.00");
		myaDcLabel_1.setBounds(215, 35, 138, 17);
		getContentPane().add(myaDcLabel_1);

		final JLabel myaDcLabel_1_1 = new JLabel();
		myaDcLabel_1_1.setHorizontalAlignment(SwingConstants.CENTER);
		myaDcLabel_1_1.setFont(new Font("Bodoni MT", Font.PLAIN, 14));
		myaDcLabel_1_1.setText("Copyright (c) 2008");
		myaDcLabel_1_1.setBounds(216, 153, 138, 17);
		getContentPane().add(myaDcLabel_1_1);

		final JLabel myaDcLabel_1_1_1 = new JLabel();
		myaDcLabel_1_1_1.setHorizontalAlignment(SwingConstants.LEFT);
		myaDcLabel_1_1_1.setFont(new Font("Bodoni MT", Font.PLAIN, 14));
		myaDcLabel_1_1_1.setText("Authors:");
		myaDcLabel_1_1_1.setBounds(216, 65, 138, 17);
		getContentPane().add(myaDcLabel_1_1_1);

		final MultiLabel namesMultiLabel = new MultiLabel();
		namesMultiLabel.setText("Marina Skarbovsky\n\rYuval Shimron\n\rAdam Levi");
		namesMultiLabel.setBounds(238, 88, 116, 47);
		getContentPane().add(namesMultiLabel);
		//
	}
	
	/**
	 * show an about window
	 * 
	 * @param owner - the frame that should own this dialog
	 * 
	 */
	public static void showAbout(JFrame owner)
	{
		AboutWindow aw = new AboutWindow(owner);
		aw.setModal(true);
		aw.setVisible(true);
	}
	
	/**
	 * closes the dialog
	 * 
	 */
	private void doClose()
	{
		this.dispose();
	}

}
